package chap4.Task1;
import java.util.Scanner;
public class Task6 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("输入N:");
        int n = input.nextInt();
        int a = 1, b = 1, c;
        System.out.println("输出斐波拉切数列的前N项:");
        System.out.print(a + "," + b + ",");
        for (int i = 1; i <= n - 2; i++) {
            c = a + b;
            if (i <= n - 3) {
                System.out.print(c + ",");
            } else {
                System.out.print(c);
            }
            a = b;
            b = c;
        }

    }
}
